home *** CD-ROM | disk | FTP | other *** search
- {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
- The purchaser of these procedures and functions may include them in COMPILED
- programs freely, but may not sell or give away the source text.
-
- This function uses the keyboard BIOS interrupt $16 (decimal 22). If "action"
- is 'W', the function WAITS until a key is pressed and then returns it. If
- action is 'N' there is NO WAIT, and a character is returned only if there
- is one in the buffer. (This is more-or-less equivalent to using TURBO's
- boolean "keypressed" function and "read(Kbd)".
- If the key pressed has an "extended" scan code (e.g., function keys,
- arrow keys) the ASCIIcode will be 0.
-
- For a chart of all scan codes, see SCANCODE.DAT
-
- This function does NOT recognize characters generated by pressing the ALT
- key and typing in numbers.
-
- NOTE that any program that INCLUDEs this file MUST also include the
- type declarations contained in REGPACK.TYP
- }
- {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
- function KeyBoard(action : char):integer;
-
- var
- registers : regpack;
- temp : integer;
- begin
- with registers do
- begin
- case UpCase(action) of
- 'W': AX := 0 ;
- 'N': AX := 1 shl 8;
- end;
- intr($16,registers);
- if action = 'N' then
- if flags and 64 = 64 then {zero flag set means no character}
- temp := 0
- else temp := KeyBoard('W')
- else temp := AX;
- KeyBoard := temp;
- end;
- end;
- {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}